package com.mxgraph.analysis;

import com.mxgraph.util.mxUtils;

import java.util.Map;

/**
 * Constants for graph structure properties
 */
public class mxGraphProperties {
    /**
     * Whether or not to navigate the graph raw graph structure or
     * the visible structure. The value associated with this key
     * should evaluate as a string to <code>1</code> or
     * <code>0</code>
     */
    public static String TRAVERSE_VISIBLE = "traverseVisible";
    /**
     * The constant DEFAULT_TRAVERSE_VISIBLE.
     */
    public static boolean DEFAULT_TRAVERSE_VISIBLE = false;
    /**
     * Whether or not to take into account the direction on edges.
     * The value associated with this key should evaluate as a
     * string to <code>1</code> or <code>0</code>
     */
    public static String DIRECTED = "directed";
    /**
     * The constant DEFAULT_DIRECTED.
     */
    public static boolean DEFAULT_DIRECTED = false;

    /**
     * Is traverse visible boolean.
     *
     * @param properties   the properties
     * @param defaultValue the default value
     * @return boolean
     */
    public static boolean isTraverseVisible(Map<String, Object> properties, boolean defaultValue) {
        if (properties != null) {
            return mxUtils.isTrue(properties, TRAVERSE_VISIBLE, defaultValue);
        }

        return false;
    }

    /**
     * Sets traverse visible.
     *
     * @param properties        the properties
     * @param isTraverseVisible the is traverse visible
     */
    public static void setTraverseVisible(Map<String, Object> properties,
                                          boolean isTraverseVisible) {
        if (properties != null) {
            properties.put(TRAVERSE_VISIBLE, isTraverseVisible);
        }
    }

    /**
     * Is directed boolean.
     *
     * @param properties   the properties
     * @param defaultValue the default value
     * @return boolean
     */
    public static boolean isDirected(Map<String, Object> properties, boolean defaultValue) {
        if (properties != null) {
            return mxUtils.isTrue(properties, DIRECTED, defaultValue);
        }

        return false;
    }

    /**
     * Sets directed.
     *
     * @param properties the properties
     * @param isDirected the is directed
     */
    public static void setDirected(Map<String, Object> properties,
                                   boolean isDirected) {
        if (properties != null) {
            properties.put(DIRECTED, isDirected);
        }
    }

    /**
     * The enum Graph type.
     */
    public enum GraphType {
        /**
         * Fully connected graph type.
         */
        FULLY_CONNECTED,
        /**
         * Random connected graph type.
         */
        RANDOM_CONNECTED,
        /**
         * Tree graph type.
         */
        TREE,
        /**
         * Flow graph type.
         */
        FLOW,
        /**
         * Null graph type.
         */
        NULL,
        /**
         * Complete graph type.
         */
        COMPLETE,
        /**
         * Nregular graph type.
         */
        NREGULAR,
        /**
         * Grid graph type.
         */
        GRID,
        /**
         * Bipartite graph type.
         */
        BIPARTITE,
        /**
         * Complete bipartite graph type.
         */
        COMPLETE_BIPARTITE,
        /**
         * Basic tree graph type.
         */
        BASIC_TREE,
        /**
         * Simple random graph type.
         */
        SIMPLE_RANDOM,
        /**
         * Bfs dir graph type.
         */
        BFS_DIR,
        /**
         * Bfs undir graph type.
         */
        BFS_UNDIR,
        /**
         * Dfs dir graph type.
         */
        DFS_DIR,
        /**
         * Dfs undir graph type.
         */
        DFS_UNDIR,
        /**
         * Dijkstra graph type.
         */
        DIJKSTRA,
        /**
         * Make tree directed graph type.
         */
        MAKE_TREE_DIRECTED,
        /**
         * Simple random tree graph type.
         */
        SIMPLE_RANDOM_TREE,
        /**
         * Knight tour graph type.
         */
        KNIGHT_TOUR,
        /**
         * Knight graph type.
         */
        KNIGHT,
        /**
         * Get adj matrix graph type.
         */
        GET_ADJ_MATRIX,
        /**
         * From adj matrix graph type.
         */
        FROM_ADJ_MATRIX,
        /**
         * Petersen graph type.
         */
        PETERSEN,
        /**
         * Wheel graph type.
         */
        WHEEL,
        /**
         * Star graph type.
         */
        STAR,
        /**
         * Path graph type.
         */
        PATH,
        /**
         * Friendship windmill graph type.
         */
        FRIENDSHIP_WINDMILL,
        /**
         * Full windmill graph type.
         */
        FULL_WINDMILL,
        /**
         * Indegree graph type.
         */
        INDEGREE,
        /**
         * Outdegree graph type.
         */
        OUTDEGREE,
        /**
         * Is cut vertex graph type.
         */
        IS_CUT_VERTEX,
        /**
         * Is cut edge graph type.
         */
        IS_CUT_EDGE,
        /**
         * Reset style graph type.
         */
        RESET_STYLE,
        /**
         * King graph type.
         */
        KING,
        /**
         * Bellman ford graph type.
         */
        BELLMAN_FORD
    }

}
